<?php
$this->breadcrumbs=array(
	UserModule::t('Users')=>array('admin'),
	UserModule::t('Manage'),
);
?>

<?php 
$userid = Yii::app()->user->id;
$user = User::model()->find('id=:ID ',array(':ID'=>$userid));
$unit_level = $user->unit_level;
?>

<div id="page-header">
	<h1><?php echo UserModule::t("用户管理"); ?></h1>
    <div id="page-options">
	<?php $this->renderPartial('_menu',array('unit_level' => $unit_level)); ?>
    </div>
</div>



<section class="grid_9" id="dashtabs">
<div class="box-header">用户列表</div>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'dataProvider'=>$dataProvider,
	'columns'=>array(
			array(
					'header' => '流水号',
					'value' => '$row + 1',
			),
		array(
			'name' => 'username',
			'type'=>'raw',
			'value' => 'CHtml::link(CHtml::encode($data->username),array("admin/view","id"=>$data->id))',
		),
		array(
				'name' => 'surname',
				'type' => 'raw',
				'value' => '$data->surname',
		),			
		array(
				'name' => 'telephone',
				'type' => 'raw',
				'value' => '$data->telephone',
		),
		array(
			'name'=>'email',
			'type'=>'raw',
			'value'=>'CHtml::link(CHtml::encode($data->email), "mailto:".$data->email)',
		),		
		array(
			'name'=>'unit_id',
			'type'=>'raw',
			'value'=>'User::model()->getUnit($data->id);',
		),
		array(
			'name'=>'role',
			'type'=>'raw',
			'value'=>'User::model()->getRole($data->id);',
		),

		array(
			'class'=>'CButtonColumn',
            'viewButtonImageUrl'=> Yii::app()->request->baseUrl.'/css/img/icons/16/page.png',            
            'updateButtonImageUrl'=> Yii::app()->request->baseUrl.'/css/img/icons/16/page_edit.png',
            'deleteButtonImageUrl'=> Yii::app()->request->baseUrl.'/css/img/icons/16/page_delete.png',
		),
	),
	'htmlOptions'=>array(
    	'class'=>'cgridview'
    ),
	'template'=>'{items}{summary}{pager}',
	'cssFile' => Yii::app()->request->baseUrl.'/css/widgets/cgridview.css'
)); ?>
</section>